<include file="Public/header" />
<title>添加账册</title>
</head>
<body>
<div class="pd-20">
<form action="__URL__/add_goods" name="postForm" id="postForm" enctype="multipart/form-data" method="post" >
	<table class="table table-border table-bordered table-bg">
		<input type="hidden" name="id" class="input-text" value="<{$detail.id}>">
				<tbody>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">商品名称</td>
				<td class="text-l" width="35%">
					<input type="text" name="goods_name" class="input-text" value="<{$detail.goods_name}>" >
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">条形码</td>
				<td class="text-l">
					<input type="text" name="bar_code" class="input-text" value="<{$detail.bar_code}>" >
				</td>				
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">品牌</td>
				<td class="text-l" width="35%">
					<input type="text" name="goods_brand" class="input-text" value="<{$detail.goods_brand}>" >
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">型号</td>
				<td class="text-l">
					<input type="text" name="goods_marque" class="input-text" value="<{$detail.goods_marque}>" >
				</td>				
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">规格</td>
				<td class="text-l" width="35%">
					<input type="text" name="goods_spec" class="input-text" value="<{$detail.goods_spec}>" >
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">价格</td>
				<td class="text-l">
					<input type="text" name="price" class="input-text" value="<{$detail.price}>" >
				</td>				
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">库存</td>
				<td class="text-l" width="35%">
					<input type="text" name="receive_amount" class="input-text" value="<{$detail.receive_amount}>" >
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">净重(g)</td>
				<td class="text-l" width="35%">
					<input type="text" name="net_weight" class="input-text" value="<{$detail.net_weight}>" >
				</td>			
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">毛重(g)</td>
				<td class="text-l">
					<input type="text" name="gross_weight" class="input-text" value="<{$detail.gross_weight}>" >
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">缩略图</td>
				<td class="text-l" width="35%">
					<input type="file" name="goods_pic" class="input-text" value="" >
					<img src="<{:get_pic($detail['goods_pic'])}>" style="width:250px;cursor:pointer" class="ss" attr_val="1" />
				</td>				
			</tr>
			<tr class="text-c">
				<td width="15%" class="text-r" style="background-color:#f5f5f5">备注1</td>
				<td class="text-l" width="35%">
					<textarea name="mark1" class="textarea" ><{$detail.mark1}></textarea>
				</td>
				<td width="15%" class="text-r" style="background-color:#f5f5f5">备注2</td>
				<td class="text-l" width="35%">
					<textarea name="mark2" class="textarea" ><{$detail.mark2}></textarea>
				</td>
			</tr>
		</tbody>
	</table>
	<input type="button" class="btn btn-primary radius mt" id="b_add" value="更新">
</form>
</div>
<script type="text/javascript" src="__PUBLIC__/js/jquery.form.js"></script>
<script>
	$(function(){
		$(document).on('mousedown','.ss',function(){
			var this_ss=$(this);
			<!-- console.log($(this).attr('src')); -->
			if($(this).attr('attr_val')==1){
				$(this).attr('attr_val',2);
				var index=layer.open({
				  type: 1,
				  shade: false,
				  title: false, //不显示标题
				  closeBtn: 0, //不显示关闭按钮
				  area: ['600px'],
				  content: "<img src="+$(this).attr('src')+" style='width:600px;'/>"
				});
				$(document).on('mousedown','body',function(){
					this_ss.attr('attr_val',1);
					layer.close(index);
				});
			}
		});

	})
	$("#b_add").click(function() { 
        $("#postForm").ajaxSubmit({  
            url: "<{:U('add_goods')}>",
            type : "post",  
            dataType : 'json',  
            success : function(data){
				if(data.status==1){
					layer.msg(data.message,function(){
						parent.window.location.href =parent.window.location.href;
					});
				}else{
					layer.msg(data.message);
				}
            },  
            error : function(data) {  
                layer.msg('出错');
            }  
        });  
    });

</script>
</body>
</html>